package tx.bjdacp.model;

import javax.persistence.*;

import org.hibernate.annotations.GenericGenerator;

import javax.validation.constraints.*;
import org.hibernate.validator.constraints.*;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import java.util.*;

import javacommon.base.*;
import javacommon.util.*;

import cn.org.rapid_framework.util.*;
import cn.org.rapid_framework.web.util.*;
import cn.org.rapid_framework.page.*;
import cn.org.rapid_framework.page.impl.*;

import tx.bjdacp.model.*;
import tx.bjdacp.dao.*;
import tx.bjdacp.service.*;
import tx.bjdacp.vo.query.*;


@Entity
@Table(name = "bjdacp_wang_dian")
public class WangDian extends BaseEntity implements java.io.Serializable{
	private static final long serialVersionUID = 5454155825314635342L;

	//alias
	public static final String TABLE_ALIAS = "网点";
	public static final String ALIAS_WANG_DIAN_ID = "wangDianId";
	public static final String ALIAS_ZONE_ID = "zoneId";
	public static final String ALIAS_ZONE_NAME = "镇名";
	public static final String ALIAS_SHOP_NAME = "商店名称";
	public static final String ALIAS_PRINCIPAL = "负责人";
	public static final String ALIAS_PHONE = "联系电话";
	public static final String ALIAS_ADDRESS = "地址";
	public static final String ALIAS_REMARK = "备注";
	public static final String ALIAS_MAIN_PROBLEM = "主要问题";

	//date formats


	//可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	//columns START
    /**
     * wangDianId       db_column: wang_dian_id
     */
	
	private java.lang.Integer wangDianId;
    /**
     * zoneId       db_column: zone_id
     */
	
	private java.lang.Integer zoneId;
    /**
     * 镇名       db_column: zone_name
     */
	@Length(max=200)
	private java.lang.String zoneName;
    /**
     * 商店名称       db_column: shop_name
     */
	@Length(max=200)
	private java.lang.String shopName;
    /**
     * 负责人       db_column: principal
     */
	@Length(max=200)
	private java.lang.String principal;
    /**
     * 联系电话       db_column: phone
     */
	@Length(max=200)
	private java.lang.String phone;
    /**
     * 地址       db_column: address
     */
	@Length(max=500)
	private java.lang.String address;
    /**
     * 备注       db_column: remark
     */
	@Length(max=1000)
	private java.lang.String remark;
    /**
     * 主要问题       db_column: main_problem
     */
	@Length(max=500)
	private java.lang.String mainProblem;
	//columns END


	public WangDian(){
	}

	public WangDian(
		java.lang.Integer wangDianId
	){
		this.wangDianId = wangDianId;
	}



	public void setWangDianId(java.lang.Integer value) {
		this.wangDianId = value;
	}

	@Id	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "wang_dian_id", unique = true, nullable = false, insertable = true, updatable = true, length = 10)
	public java.lang.Integer getWangDianId() {
		return this.wangDianId;
	}

	@Column(name = "zone_id", unique = false, nullable = true, insertable = true, updatable = true, length = 10)
	public java.lang.Integer getZoneId() {
		return this.zoneId;
	}

	public void setZoneId(java.lang.Integer value) {
		this.zoneId = value;
	}

	@Column(name = "zone_name", unique = false, nullable = true, insertable = true, updatable = true, length = 200)
	public java.lang.String getZoneName() {
		return this.zoneName;
	}

	public void setZoneName(java.lang.String value) {
		this.zoneName = value;
	}

	@Column(name = "shop_name", unique = false, nullable = true, insertable = true, updatable = true, length = 200)
	public java.lang.String getShopName() {
		return this.shopName;
	}

	public void setShopName(java.lang.String value) {
		this.shopName = value;
	}

	@Column(name = "principal", unique = false, nullable = true, insertable = true, updatable = true, length = 200)
	public java.lang.String getPrincipal() {
		return this.principal;
	}

	public void setPrincipal(java.lang.String value) {
		this.principal = value;
	}

	@Column(name = "phone", unique = false, nullable = true, insertable = true, updatable = true, length = 200)
	public java.lang.String getPhone() {
		return this.phone;
	}

	public void setPhone(java.lang.String value) {
		this.phone = value;
	}

	@Column(name = "address", unique = false, nullable = true, insertable = true, updatable = true, length = 500)
	public java.lang.String getAddress() {
		return this.address;
	}

	public void setAddress(java.lang.String value) {
		this.address = value;
	}

	@Column(name = "remark", unique = false, nullable = true, insertable = true, updatable = true, length = 1000)
	public java.lang.String getRemark() {
		return this.remark;
	}

	public void setRemark(java.lang.String value) {
		this.remark = value;
	}

	@Column(name = "main_problem", unique = false, nullable = true, insertable = true, updatable = true, length = 500)
	public java.lang.String getMainProblem() {
		return this.mainProblem;
	}

	public void setMainProblem(java.lang.String value) {
		this.mainProblem = value;
	}


	private Zone zone;
	public void setZone(Zone zone){
		this.zone = zone;
	}

	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumns({
		@JoinColumn(name = "zone_id",nullable = false, insertable = false, updatable = false) 
	})
	public Zone getZone() {
		return zone;
	}

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("WangDianId",getWangDianId())
			.append("ZoneId",getZoneId())
			.append("ZoneName",getZoneName())
			.append("ShopName",getShopName())
			.append("Principal",getPrincipal())
			.append("Phone",getPhone())
			.append("Address",getAddress())
			.append("Remark",getRemark())
			.append("MainProblem",getMainProblem())
			.toString();
	}

	public int hashCode() {
		return new HashCodeBuilder()
			.append(getWangDianId())
			.toHashCode();
	}

	public boolean equals(Object obj) {
		if(obj instanceof WangDian == false) return false;
		if(this == obj) return true;
		WangDian other = (WangDian)obj;
		return new EqualsBuilder()
			.append(getWangDianId(),other.getWangDianId())
			.isEquals();
	}
}

